<script setup>
import "@/assets/fonts/iconfont/iconfont";

const props = defineProps({
  name: {
    type: String,
    default: "",
  },
  type: {
    type: String,
    default: "",
  },
});

const icon = computed(() => {
  let id;
  if (props.name) {
    id = props.name;
  } else {
    id = props.type;
  }
  return `#${id.includes("icon") ? id : "icon-" + id}`;
});
</script>

<template>
  <svg class="icon" fill="currentColor">
    <use :xlink:href="icon"></use>
  </svg>
</template>

<style scoped lang="scss">
.icon {
  display: inline-block;
  width: 1em;
  height: 1em;
  color: inherit;
  font-style: normal;
  vertical-align: -2px;
  outline: 0;
  stroke: currentColor;
}
</style>
